import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter);

const routes = [
    {
        path: '/',
        name: '大盘',
        component: () => import(  '../views/Dapan.vue')
    },
    {
        path: '/dapan',
        name: '大盘',
        component: () => import(  '../views/Dapan.vue')
    },
    {
        path: '/hold',
        name: '持股',
        component: () => import('../views/Hold.vue')
    },
    {
        path: '/config',
        name: '配置',
        component: () => import('../views/Config.vue')
    },
    {
        path: '/news',
        name: '新闻',
        component: () => import('../views/News.vue')
    },
    {
        path: '/watchChaoDi',
        name: '监控',
        component: () => import('../views/WatchChaoDi.vue')
    },
    {
        path: '/recording',
        name: '条件单',
        component: () => import('../views/Recording.vue')
    }
];

const router = new VueRouter({
    routes
});
//导航钩子
router.beforeEach((to, from, next) => {
    //微信跳转token
    if (to.query.token) {
        localStorage.setItem('token', to.query.token)
    }
    //普通放行
    next();
});

export default router
